local assets = {
    Asset("ANIM", "anim/rg_trinkets_ds.zip"),
    Asset("ANIM", "anim/rg_trinkets_dst.zip"),
}

local BUFFS = require "prefabs/rg_trinkets_buff"

local TRINKETS_DS_START = 1
local TRINKETS_DS_END   = 23
local TRINKETS_DST_START = 1
local TRINKETS_DST_END  = 46

local function MakeTrinket(num)

    local name = "rg_trinket_"..tostring(num)
    
    local function fn(Sim)
        local inst = CreateEntity()
        
        inst.entity:AddTransform()
        inst.entity:AddAnimState()
        
        MakeInventoryPhysics(inst)
        MakeInventoryFloatable(inst, tostring(num).."_water", tostring(num))
        
        inst.AnimState:SetBank("rg_trinkets_ds")
        inst.AnimState:SetBuild("rg_trinkets_ds")
        inst.AnimState:PlayAnimation(tostring(num))
        
        inst:AddComponent("inspectable")
        inst:AddComponent("stackable")
		inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM

        inst:AddComponent("inventoryitem")
        inst:AddComponent("tradable")

        inst:AddTag("trinket")

        return inst
    end
    
    return Prefab( name, fn, assets)
end

local ret = {}
for k =1,NUM_TRINKETS do
    table.insert(ret, MakeTrinket(k))
end

return unpack(ret) 
